<?php

namespace app\payment;

use app\services\PropertyService;
use plugin\admin\app\model\UserProperty;
use plugin\admin\app\model\UserPropertyLog;

class BalancePay extends AbstractPay
{
    public function pay()
    {
        if ($this->data['total_amount'] > 0) {
            PropertyService::reduce(get_user_id(), PayFactory::BALANCE, $this->data['total_amount'], $this->data['source']);
        }
    }

    public function payBack()
    {
        if ($this->data['total_amount'] > 0) {
            PropertyService::add($this->data['user_id'], PayFactory::BALANCE, $this->data['total_amount'], $this->data['source']);
        }
    }
}